added SSCLI 1.0
[windows-sources.git] / shared source / wpf / src / host / dll / oleinplaceactiveobject.cxx
blob88a6b4e3b2c047511c28c8f021d490bd59429651
1 //+-----------------------------------------------------------------------
2 //
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 //
5 // Description:
6 // Implements the OleInPlaceActiveObject class of PresentationHost.
7 //
8 // History:
9 // 2002/06/27-murrayw
10 // Created
11 // 2007/09/20-[....]
12 // Ported Windows->DevDiv. See SourcesHistory.txt.
14 //------------------------------------------------------------------------
16 #include "Precompiled.hxx"
17 #include "OleInPlaceActiveObject.hxx"
18 #include "OleDocument.hxx"
19 #include "Utilities.hxx"
21 //******************************************************************************
23 // COleInPlaceActiveObject::COleInPlaceActiveObject()
24 //
25 //******************************************************************************
27 COleInPlaceActiveObject::COleInPlaceActiveObject(__in COleDocument *pOleDoc)
29 m_pOleDoc = pOleDoc;
30 //m_fEnableModeless = FALSE;
32 //******************************************************************************
34 // COleInPlaceActiveObject::~COleInPlaceActiveObject()
35 //
36 //******************************************************************************
38 COleInPlaceActiveObject::~COleInPlaceActiveObject()
42 //******************************************************************************
44 // COleInPlaceActiveObject::QueryInterface()
45 //
46 //******************************************************************************
48 STDMETHODIMP COleInPlaceActiveObject::QueryInterface(REFIID riid,
49 __out LPVOID *ppReturn)
51 // IE queries for IInputObject via CHostShim.
53 return m_pOleDoc->QueryInterface(riid, ppReturn);
56 //******************************************************************************
58 // COleInPlaceActiveObject::AddRef()
59 //
60 //******************************************************************************
62 STDMETHODIMP_(ULONG) COleInPlaceActiveObject::AddRef()
64 return m_pOleDoc->AddRef();
67 //******************************************************************************
69 // COleInPlaceActiveObject::Release()
70 //
71 //******************************************************************************
73 STDMETHODIMP_(ULONG) COleInPlaceActiveObject::Release()
75 return m_pOleDoc->Release();
78 //******************************************************************************
80 // COleInPlaceActiveObject::OnDocWindowActivate()
81 //
82 //******************************************************************************
84 STDMETHODIMP COleInPlaceActiveObject::OnDocWindowActivate(BOOL fActivate)
86 return S_OK;
89 //******************************************************************************
91 // COleInPlaceActiveObject::OnFrameWindowActivate()
92 //
93 //******************************************************************************
95 STDMETHODIMP COleInPlaceActiveObject::OnFrameWindowActivate(BOOL fActivate )
97 IBrowserHostServices *pBrowserHost;
99 pBrowserHost = m_pOleDoc->ApplicationHelper();
101 if ( pBrowserHost != NULL )
103 pBrowserHost->Activate(fActivate);
106 return S_OK;
109 //******************************************************************************
111 // COleInPlaceActiveObject::GetWindow()
113 //******************************************************************************
115 STDMETHODIMP COleInPlaceActiveObject::GetWindow(__out HWND *phwnd)
117 return m_pOleDoc->GetWindow(phwnd);
120 //******************************************************************************
122 // COleInPlaceActiveObject::ContextSensitiveHelp()
124 //******************************************************************************
126 STDMETHODIMP COleInPlaceActiveObject::ContextSensitiveHelp(BOOL /* fEnterMode */)
128 return E_NOTIMPL;
131 //******************************************************************************
132 // COleInPlaceActiveObject::TranslateAccelerator()
133 // We would look up our own accelerators here, but we don't have any.
134 //******************************************************************************
136 STDMETHODIMP COleInPlaceActiveObject::TranslateAccelerator(LPMSG pMsg)
138 // no accelerator table, return FALSE
140 return S_FALSE;
143 //******************************************************************************
145 // COleInPlaceActiveObject::ResizeBorder()
147 //******************************************************************************
149 STDMETHODIMP COleInPlaceActiveObject::ResizeBorder(LPCRECT /* lprectBorder */,
150 LPOLEINPLACEUIWINDOW /* lpUIWindow */,
151 BOOL /* fFrameWindow */)
153 return S_OK;
156 //******************************************************************************
158 // COleInPlaceActiveObject::EnableModeless()
160 //******************************************************************************
162 STDMETHODIMP COleInPlaceActiveObject::EnableModeless(BOOL fEnable)
164 STD_ASSERT_UNUSED;
166 m_fEnableModeless = fEnable;
168 return S_OK;
172 //******************************************************************************
174 // IInputObject implementation. Used by IE.
175 // Enables tabbing into the DocObject from the browser frame.
176 // Tabbing into an HTML frame with our DocObject is handled by COleObject::DoVerb().
177 // Tabbing out is via IBrowserCallbackServices::TabOut().
179 // In Firefox, tabbing in is done via IOleCommandTarget and a custom command - PHCMDID_TABINTO.
181 STDMETHODIMP COleInPlaceActiveObject::TranslateAcceleratorIO(__in MSG *pMsg)
183 HRESULT hr = E_FAIL;
185 int nDir = IsTabCycler(*pMsg);
186 if(nDir && HasFocusIO() == S_FALSE && m_pOleDoc->ApplicationHelper())
188 hr = m_pOleDoc->ApplicationHelper()->TabInto(nDir > 0);
191 return hr;
194 STDMETHODIMP COleInPlaceActiveObject::HasFocusIO()
196 HRESULT hr = S_FALSE;
197 HWND hwnd = NULL;
198 if (SUCCEEDED(GetWindow(&hwnd)))
200 HWND hwndFocus = GetFocus();
201 if (hwnd == hwndFocus || IsChild(hwnd, hwndFocus))
203 hr = S_OK;
206 return hr;
209 STDMETHODIMP COleInPlaceActiveObject::UIActivateIO(BOOL fActivate, __in_opt MSG *pMsg)
211 // This is currently not used, but in general it should UI activate/deactivate.
212 return OnDocWindowActivate(fActivate);